<template>
  <div class="app-container" ref="content">
    <div style="text-align: center;padding: 10px">任务《{{taskInfo.name}}》-详情信息</div>
    <div style="margin: 10px auto;text-align: center ">
      <el-button type="primary" size="mini" v-if="taskInfo.status==1" @click="taskReturn" align="center">任务退回</el-button>
    </div>
    <el-row :gutter="10">
      <el-col :span="12" :offset="6">
        <el-form :model="taskInfo" ref="taskInfo" label-width="150px">
              <el-form-item label="任务名称:" prop="name">
                {{ taskInfo.name }}
              </el-form-item>
              <el-form-item label="任务类型:" prop="type">
                {{ taskInfo.type | taskType }}
              </el-form-item>
              <el-form-item label="任务要求:" prop="remark">
                {{ taskInfo.remark }}
              </el-form-item>
              <el-form-item label="任务内容:" prop="content">
                {{ taskInfo.content }}
              </el-form-item>
              <el-form-item label="任务时间段:" prop="startTime">
                {{ taskInfo.startTime | timeFormat }}-{{ taskInfo.endTime | timeFormat }}
              </el-form-item>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {getInTaskReleaseVo} from "@/api/enterpriseTask";
import {taskReturn} from "../../../api/enterpriseTask";

export default {
  name: "taskInfo",
  data(){
    return{
      taskInfo:{
      },
    }
  },
  created() {
      this.getInTaskReleaseVo()
  },
  methods:{
    getInTaskReleaseVo(){
      getInTaskReleaseVo({ucId:this.$route.params.ucId}).then(res=>{
        this.taskInfo = res.data
        this.$notify.success({
          title: '成功',
          message: "获取任务信息成功"
        })
      }).catch(error=>{
        this.$notify.error({
          title: '失败',
          message: error.message
        })
      })
    },
    taskReturn() {
      taskReturn({ucId: this.$route.params.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "任务已退回"
        })
        this.getInTaskReleaseVo()
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },

  },

}
</script>
